package com.circle.interests.biz.controller;

import com.circle.common.core.utils.R;
import com.circle.common.core.validator.AddGroup;
import com.circle.interests.biz.request.ActPrizeInventoryIncreaseRequest;
import com.circle.interests.biz.service.IPrizeInventoryService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zhou
 * @date 2021/12/6
 */
@Slf4j
@Api(tags = {"奖品库存管理（pc端接口）"})
@RestController
@RequestMapping("prizeInventory")
@ApiSupport(author = "周福寿")
public class PrizeInventoryController {

    @Resource
    private IPrizeInventoryService prizeInventoryService;

    @ApiOperation("修改活动奖品库存")
    @PostMapping("/modifyActInventory")
    public R<Integer> modifyInventory(@Validated({AddGroup.class}) @RequestBody ActPrizeInventoryIncreaseRequest form) {
        Integer total = prizeInventoryService.modifyInventory(1, form.getActCode(), form.getPrizeCode(), form.getCount());
        return R.success(total);
    }

}
